// <copyright file="Date.cs" company="Alan Dean">
// The MIT License

// Copyright (c) 2008 Alan Dean

// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// </copyright>
// <author>Alan Dean</author>
// <email>alan.dean@thoughtpad.net</email>

namespace Semantic.Rdf.DublinCore
{
    using System;
    using System.Diagnostics.CodeAnalysis;
    using System.Runtime.Serialization;

    /// <summary>
    /// Represents a Dublin Core <see href="http://dublincore.org/documents/dces/#date">date</see> property.
    /// <para>This class cannot be inherited.</para>
    /// </summary>
    /// 
    /// <remarks>
    /// <list type="table">
    /// <item>
    ///   <term>Definition</term>
    ///   <description>
    ///   A point or period of time associated with an event in the lifecycle of the resource.
    ///   </description>
    /// </item>
    /// <item>
    ///   <term>Comment</term>
    ///   <description>
    ///   Date may be used to express temporal information at any level of granularity.
    ///   Recommended best practice is to use an encoding scheme, such as the
    ///   <see href="http://www.w3.org/TR/NOTE-datetime">W3CDTF profile of ISO 8601</see>.
    ///   </description>
    /// </item>
    /// </list>
    /// </remarks>
    /// 
    /// <seealso href="http://dublincore.org/documents/dces/">
    /// Dublin Core Metadata Element Set, Version 1.1
    /// </seealso>
    [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Date", Justification = "This is the correct naming.")]
    [Serializable]
    public sealed class Date : Triple
    {
        #region fields

        /// <summary>
        /// Stores the <see cref="P:Semantic.Rdf.DublinCore.Date.Predicate"/> data.
        /// </summary>
        private static readonly IUriReference _predicate = new UriReference("http://purl.org/dc/elements/1.1/date");
        
        #endregion

        #region public Date(IUriReference, DateTime)
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Semantic.Rdf.DublinCore.Date"/> class
        /// with the specified <paramref name="subject"/> and <paramref name="obj">object</paramref>.
        /// </summary>
        ///
        /// <param name="subject">The subject of the triple.</param>
        /// <param name="obj">The object of the triple.</param>
        /// 
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="subject"/> is a <see langword="null"/> reference.<br/>-or-<br/>
        /// <paramref name="obj"/> is a <see langword="null"/> reference.
        /// </exception>
        [SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "obj", Justification = "This is the appropriate naming.")]
        public Date(IUriReference subject, DateTime obj)
            : base(subject, _predicate, obj)
        {
        }
        #endregion

        #region public Date(IUriReference, string)
        /// <overloads>
        /// Overloaded.
        /// Initializes a new instance of the <see cref="T:Semantic.Rdf.DublinCore.Date"/> class.
        /// </overloads>
        /// 
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Semantic.Rdf.DublinCore.Date"/> class
        /// with the specified <paramref name="subject"/> and <paramref name="obj">object</paramref>.
        /// </summary>
        ///
        /// <param name="subject">The subject of the triple.</param>
        /// <param name="obj">The object of the triple.</param>
        /// 
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="subject"/> is a <see langword="null"/> reference.<br/>-or-<br/>
        /// <paramref name="obj"/> is a <see langword="null"/> reference.
        /// </exception>
        [SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "obj", Justification = "This is the appropriate naming.")]
        public Date(IUriReference subject, string obj)
            : base(subject, _predicate, obj)
        {
        }
        #endregion

        #region private Date(SerializationInfo, StreamingContext)
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Semantic.Rdf.DublinCore.Date"/> class
        /// from the specified instances of the <see cref="T:System.Runtime.Serialization.SerializationInfo"/>
        /// and <see cref="T:System.Runtime.Serialization.StreamingContext"/> classes.
        /// </summary>
        /// 
        /// <param name="info">
        /// An instance of the  <see cref="T:System.Runtime.Serialization.SerializationInfo"/> class
        /// containing the information required to serialize the
        /// new <see cref="T:Semantic.Rdf.BooleanLiteral"/> instance. 
        /// </param>
        /// <param name="context">
        /// An instance of the <see cref="T:System.Runtime.Serialization.StreamingContext"/> class
        /// containing the source of the serialized stream associated with the
        /// new <see cref="T:Semantic.Rdf.BooleanLiteral"/> instance.
        /// </param>
        /// 
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="info"/> is a <see langword="null"/> reference.
        /// </exception>
        private Date(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
        }
        #endregion
    }
}